#include "StompedReality/Core/FileSystem.h"
#include "StomperLib/Controls/ProjectInfo.h"
namespace StomperLib {
namespace Controls {
GWEN_CONTROL_CONSTRUCTOR( ProjectInfo )
{
  Gwen::Controls::Properties* props = this->Add( L"Project" );
  this->m_ProjectPathRow = props->Add( L"Path", "" );
  this->m_ProjectFileRow = props->Add( L"File", "" );
  this->ExpandAll( );
}
void ProjectInfo::OnOpenProject( Gwen::Event::Info info )
{
  int p = info.String.Get( ).find_last_of( FILE_SEPARATORE );
  this->SetProjectPath( info.String.Get( ).substr( 0, p ));
  this->SetProjectFile( info.String.Get( ).substr( p+1, info.String.Get( ).length( )-p ));
}

const Gwen::String ProjectInfo::GetProjectPath( )
{
  return this->m_ProjectPathRow->GetProperty( )->GetPropertyValue( ).Get( );
}

void ProjectInfo::SetProjectPath( const Gwen::String path )
{
  this->m_ProjectPathRow->GetProperty( )->SetPropertyValue( path );
}

const Gwen::String ProjectInfo::GetProjectFile( )
{
  return this->m_ProjectFileRow->GetProperty( )->GetPropertyValue( ).Get( );
}

void ProjectInfo::SetProjectFile( const Gwen::String path )
{
  this->m_ProjectFileRow->GetProperty( )->SetPropertyValue( path );
}

}
}